<?php
define('IN_TG','member_flower');
define('IN_JS',true);
define('SCRIPT','member_flower');
session_start();
require('includes/common.inc.php');
//加载头部文件
require('header.php');
//分页计算
$size = 10;
$sql="select tg_fromuser,tg_content,tg_flower,tg_date from tg_flower where tg_touser ='{$_SESSION['username']}'";
_page($sql,$size);
$sql .= " order by tg_id limit $_pagenum,$size";
$res = _query($sql);
$flower_arr = array();
while ($row = _fetch_array_list($res)) {
    $flower_arr[] = $row;
}
?>
    <div id="member">
        <?php
        require ("includes/member.inc.php");
        ?>
        <div id="member_main">
            <h2>查询花朵</h2>
            <?php if (count($flower_arr) > 0): ?>
            <table cellspacing="1">
                <tr>
                    <th>送花人</th>
                    <th>请求内容</th>
                    <th>时间</th>
                    <th>花朵数</th>
                </tr>
                <?php foreach ($flower_arr as $row): ?>
                    <tr><td><?php echo $row['tg_fromuser']?></td><td title="<?php echo $row['tg_content']?>"><?php echo $row['tg_content']?></td><td><?php echo $row['tg_date']?></td><td><?php echo $row['tg_flower']?>朵花</td></tr>
                <?php endforeach; ?>
            </table>
            <div id="page_text"><?php _paging(2)?></div>
            <?php else: ?>
                <h3 style="text-align:center;margin-top:20px;">暂无相关数据</h3>
            <?php endif; ?>
        </div>
    </div>

<?php
require('includes/footer.inc.php');
?>